package com.view.jameson.androidrecyclerviewcard.hv2;

import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;

public class HorizontalSpaceItemDecoration extends RecyclerView.ItemDecoration {
    private final int mSpacing;

    public HorizontalSpaceItemDecoration( int spacing) {
        mSpacing = spacing;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        int position = parent.getChildAdapterPosition(view);
        if (position != RecyclerView.NO_POSITION) {
            outRect.set(0, 0, mSpacing, 0);
        }
    }
}
